﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Obra.Api;
using NUnit.Framework;
using Obra.SmugMug.Api;

namespace Obra.Test
{
    [TestFixture]
    public class KeywordTester
    {
        [SetUp]
        public void SetUp()
        {
        }

        [TearDown]
        public void TearDown()
        {
        }

        [Test]
        public void KeywordIEnumberable()
        {
           string[] words = new string [] {
                "mammal", "dog", "cat", "hair"};

            Keywords keywords = new Keywords(words);

            Assert.AreEqual(4, keywords.Count);
            Assert.IsTrue(keywords.Contains("mammal"));
            Assert.IsTrue(keywords.Contains("dog"));
            Assert.IsTrue(keywords.Contains("cat"));
            Assert.IsTrue(keywords.Contains("hair"));

            Assert.IsFalse(keywords.Contains("fish"));
            Assert.IsFalse(keywords.Contains("duck"));
        }

        [Test]
        public void KeywordString()
        {
            Keywords keywords = new Keywords(
                "mammal; dog; cat; dolphin; hair");

            Assert.AreEqual(5, keywords.Count);
            Assert.IsTrue (keywords.Contains ("mammal"));
            Assert.IsTrue (keywords.Contains ("dog"));
            Assert.IsTrue (keywords.Contains ("cat"));
            Assert.IsTrue (keywords.Contains ("dolphin"));
            Assert.IsTrue (keywords.Contains ("hair"));
        }

        [Test]
        public void KeywordStringOne()
        {
            Keywords keywords = new Keywords("mammal");

            Assert.AreEqual(1, keywords.Count);
            Assert.IsTrue(keywords.Contains("mammal"));
        }

        [Test]
        public void KeywordStringOneWithDelimiter()
        {
            Keywords keywords = new Keywords("mammal;");

            Assert.AreEqual(1, keywords.Count);
            Assert.IsTrue(keywords.Contains("mammal"));
        }
    }
}
